package com.yowasa.xiuxian.engine.battle.strategy.drop.all;

import com.yowasa.xiuxian.annoations.BS;
import com.yowasa.xiuxian.engine.battle.strategy.BaseDefendStrategy;
import com.yowasa.xiuxian.engine.battle.strategy.BattleStrategy;
import com.yowasa.xiuxian.entity.bo.battle.BattleContent;
import com.yowasa.xiuxian.entity.bo.battle.UserBattleContent;
import com.yowasa.xiuxian.entity.bo.user.UserBO;
import com.yowasa.xiuxian.entity.enums.ElementEnum;
import com.yowasa.xiuxian.exception.HandlerException;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;


@BS(name="无念无想", upAbility = 4, needTravel = 1000)
@Order(1)
@Component
public class WuNianWuXiang  extends BaseDefendStrategy {
    @Override
    public ElementEnum getElement() {
        return null;
    }
    @Override
    public int defend(UserBattleContent user, UserBattleContent battleUser, BattleStrategy bs, int dmg, BattleContent content) {
        if (user.getBattleInfo().getChp() <= user.getBattleInfo().getHp()/2  && user.getBattleInfo().getCmp() >= 200) {
            user.getBattleInfo().setCmp(user.getBattleInfo().getCmp() - 200);
            return dmg*2/3;
        }
        return dmg;
    }

    @Override
    public void limit(UserBO user) {
        if (user.getStage() < 5) {
            throw new HandlerException("学习/使用无念无想阶位需要在如曜之金以上");
        }
    }

    @Override
    public String limitDesc() {
        return "学习/使用无念无想阶位需要在如曜之金以上";
    }



    @Override
    public String desc() {
        return "无念无想，泡影断灭，常道恢弘，鸣神永恒！\n生命值降低到一半以下会开启，减免1/3所受到的伤害，每次减伤会消耗200mp";
    }

}
